We import the response values and errors derived in Notebook 4 and save the results in a MIRI MRS CDP format.
from IPython.display import HTML
HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.input').hide();
} else {
$('div.input').show();
}
code_show = !code_show
}
$( document ).ready(code_toggle);
</script>
The raw code for this IPython notebook is by default hidden for easier reading.
To toggle on/off the raw code, click <a href="javascript:code_toggle()">here</a>.''')
# import modules
import funcs
import mrsobs
import numpy as np
from astropy.io import fits
import matplotlib.pyplot as plt
plt.style.use('presentation')
%matplotlib notebook
import warnings
warnings.simplefilter('ignore')
# Define paths to data
workDir = '/Users/ioannisa/Desktop/python/miri_devel/'
cdpDir = workDir+'cdp_data/CDP7/'
DGAA = 'SHORT'
DGAB = 'MEDIUM'
filename = 'MIRI_FM_MIRIFUSHORT_12{}_PHOTOM_7B.00.00.fits'.format(DGAA+DGAB)
response = fits.open(cdpDir+filename)[1].data
plt.figure(figsize=(9,6))
plt.title('Response {}/{} (1A/2BxA)'.format(DGAA,DGAB),fontsize=18)
sc = plt.imshow(response,cmap='jet',vmin=0,vmax=5)
cbar = plt.colorbar(sc,pad = 0.03)
cbar.set_label(r'Response [(DN/sec)/(mJy/pix)]', labelpad=30,rotation=270)
plt.xlabel('Detector x-coordinate [pix]')
plt.ylabel('Detector y-coordinate [pix]')
plt.tight_layout()
DGAA = 'SHORT'
DGAB = 'LONG'
filename = 'MIRI_FM_MIRIFUSHORT_12{}_PHOTOM_7B.00.00.fits'.format(DGAA+DGAB)
response = fits.open(cdpDir+filename)[1].data
plt.figure(figsize=(9,6))
plt.title('Response {}/{} (1A/2CxA)'.format(DGAA,DGAB),fontsize=18)
sc = plt.imshow(response,cmap='jet',vmin=0,vmax=5)
cbar = plt.colorbar(sc,pad = 0.03)
cbar.set_label(r'Response [(DN/sec)/(mJy/pix)]', labelpad=30,rotation=270)
plt.xlabel('Detector x-coordinate [pix]')
plt.ylabel('Detector y-coordinate [pix]')
plt.tight_layout()
DGAA = 'MEDIUM'
DGAB = 'SHORT'
filename = 'MIRI_FM_MIRIFUSHORT_12{}_PHOTOM_7B.00.00.fits'.format(DGAA+DGAB)
response = fits.open(cdpDir+filename)[1].data
plt.figure(figsize=(9,6))
plt.title('Response {}/{} (1B/2AxB)'.format(DGAA,DGAB),fontsize=18)
sc = plt.imshow(response,cmap='jet',vmin=0,vmax=5)
cbar = plt.colorbar(sc,pad = 0.03)
cbar.set_label(r'Response [(DN/sec)/(mJy/pix)]', labelpad=30,rotation=270)
plt.xlabel('Detector x-coordinate [pix]')
plt.ylabel('Detector y-coordinate [pix]')
plt.tight_layout()
DGAA = 'MEDIUM'
DGAB = 'LONG'
filename = 'MIRI_FM_MIRIFUSHORT_12{}_PHOTOM_7B.00.00.fits'.format(DGAA+DGAB)
response = fits.open(cdpDir+filename)[1].data
plt.figure(figsize=(9,6))
plt.title('Response {}/{} (1B/2CxB)'.format(DGAA,DGAB),fontsize=18)
sc = plt.imshow(response,cmap='jet',vmin=0,vmax=5)
cbar = plt.colorbar(sc,pad = 0.03)
cbar.set_label(r'Response [(DN/sec)/(mJy/pix)]', labelpad=30,rotation=270)
plt.xlabel('Detector x-coordinate [pix]')
plt.ylabel('Detector y-coordinate [pix]')
plt.tight_layout()
DGAA = 'LONG'
DGAB = 'SHORT'
filename = 'MIRI_FM_MIRIFUSHORT_12{}_PHOTOM_7B.00.00.fits'.format(DGAA+DGAB)
response = fits.open(cdpDir+filename)[1].data
plt.figure(figsize=(9,6))
plt.title('Response {}/{} (1C/2AxC)'.format(DGAA,DGAB),fontsize=18)
sc = plt.imshow(response,cmap='jet',vmin=0,vmax=5)
cbar = plt.colorbar(sc,pad = 0.03)
cbar.set_label(r'Response [(DN/sec)/(mJy/pix)]', labelpad=30,rotation=270)
plt.xlabel('Detector x-coordinate [pix]')
plt.ylabel('Detector y-coordinate [pix]')
plt.tight_layout()
DGAA = 'LONG'
DGAB = 'MEDIUM'
filename = 'MIRI_FM_MIRIFUSHORT_12{}_PHOTOM_7B.00.00.fits'.format(DGAA+DGAB)
response = fits.open(cdpDir+filename)[1].data
plt.figure(figsize=(9,6))
plt.title('Response {}/{} (1C/2BxC)'.format(DGAA,DGAB),fontsize=18)
sc = plt.imshow(response,cmap='jet',vmin=0,vmax=5)
cbar = plt.colorbar(sc,pad = 0.03)
cbar.set_label(r'Response [(DN/sec)/(mJy/pix)]', labelpad=30,rotation=270)
plt.xlabel('Detector x-coordinate [pix]')
plt.ylabel('Detector y-coordinate [pix]')
plt.tight_layout()
DGAA = 'SHORT'
DGAB = 'MEDIUM'
filename = 'MIRI_FM_MIRIFULONG_34{}_PHOTOM_7B.00.00.fits'.format(DGAA+DGAB)
response = fits.open(cdpDir+filename)[1].data
plt.figure(figsize=(9,6))
plt.title('Response {}/{} (4AxB/3BxA)'.format(DGAA,DGAB),fontsize=18)
sc = plt.imshow(response,cmap='jet',vmin=0,vmax=4)
cbar = plt.colorbar(sc,pad = 0.03)
cbar.set_label(r'Response [(DN/sec)/(mJy/pix)]', labelpad=30,rotation=270)
plt.xlabel('Detector x-coordinate [pix]')
plt.ylabel('Detector y-coordinate [pix]')
plt.tight_layout()
DGAA = 'SHORT'
DGAB = 'LONG'
filename = 'MIRI_FM_MIRIFULONG_34{}_PHOTOM_7B.00.00.fits'.format(DGAA+DGAB)
response = fits.open(cdpDir+filename)[1].data
plt.figure(figsize=(9,6))
plt.title('Response {}/{} (4AxC/3CxA)'.format(DGAA,DGAB),fontsize=18)
sc = plt.imshow(response,cmap='jet',vmin=0,vmax=4)
cbar = plt.colorbar(sc,pad = 0.03)
cbar.set_label(r'Response [(DN/sec)/(mJy/pix)]', labelpad=30,rotation=270)
plt.xlabel('Detector x-coordinate [pix]')
plt.ylabel('Detector y-coordinate [pix]')
plt.tight_layout()
DGAA = 'MEDIUM'
DGAB = 'SHORT'
filename = 'MIRI_FM_MIRIFULONG_34{}_PHOTOM_7B.00.00.fits'.format(DGAA+DGAB)
response = fits.open(cdpDir+filename)[1].data
plt.figure(figsize=(9,6))
plt.title('Response {}/{} (4BxA/3AxB)'.format(DGAA,DGAB),fontsize=18)
sc = plt.imshow(response,cmap='jet',vmin=0,vmax=4)
cbar = plt.colorbar(sc,pad = 0.03)
cbar.set_label(r'Response [(DN/sec)/(mJy/pix)]', labelpad=30,rotation=270)
plt.xlabel('Detector x-coordinate [pix]')
plt.ylabel('Detector y-coordinate [pix]')
plt.tight_layout()
DGAA = 'MEDIUM'
DGAB = 'LONG'
filename = 'MIRI_FM_MIRIFULONG_34{}_PHOTOM_7B.00.00.fits'.format(DGAA+DGAB)
response = fits.open(cdpDir+filename)[1].data
plt.figure(figsize=(9,6))
plt.title('Response {}/{} (4BxC/3CxB)'.format(DGAA,DGAB),fontsize=18)
sc = plt.imshow(response,cmap='jet',vmin=0,vmax=4)
cbar = plt.colorbar(sc,pad = 0.03)
cbar.set_label(r'Response [(DN/sec)/(mJy/pix)]', labelpad=30,rotation=270)
plt.xlabel('Detector x-coordinate [pix]')
plt.ylabel('Detector y-coordinate [pix]')
plt.tight_layout()
DGAA = 'LONG'
DGAB = 'SHORT'
filename = 'MIRI_FM_MIRIFULONG_34{}_PHOTOM_7B.00.00.fits'.format(DGAA+DGAB)
response = fits.open(cdpDir+filename)[1].data
plt.figure(figsize=(9,6))
plt.title('Response {}/{} (4CxA/3AxC)'.format(DGAA,DGAB),fontsize=18)
sc = plt.imshow(response,cmap='jet',vmin=0,vmax=4)
cbar = plt.colorbar(sc,pad = 0.03)
cbar.set_label(r'Response [(DN/sec)/(mJy/pix)]', labelpad=30,rotation=270)
plt.xlabel('Detector x-coordinate [pix]')
plt.ylabel('Detector y-coordinate [pix]')
plt.tight_layout()
DGAA = 'LONG'
DGAB = 'MEDIUM'
filename = 'MIRI_FM_MIRIFULONG_34{}_PHOTOM_7B.00.00.fits'.format(DGAA+DGAB)
response = fits.open(cdpDir+filename)[1].data
plt.figure(figsize=(9,6))
plt.title('Response {}/{} (4CxB/3BxC)'.format(DGAA,DGAB),fontsize=18)
sc = plt.imshow(response,cmap='jet',vmin=0,vmax=4)
cbar = plt.colorbar(sc,pad = 0.03)
cbar.set_label(r'Response [(DN/sec)/(mJy/pix)]', labelpad=30,rotation=270)
plt.xlabel('Detector x-coordinate [pix]')
plt.ylabel('Detector y-coordinate [pix]')
plt.tight_layout()